Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using sed with \ and ' and <CR><LF>

0 views
Skip to first unread message

Lelio Fulgenzi

unread,
Oct 7, 1993, 5:47:12 PM10/7/93
to
This has got me stumped:

I want to search for:


PS1=\\
[ "'$HOSTNAME ]
[ $PWD'" ] "

and replace with something alot simpler, for example,

PS1='[ $PWD ]'

any clues?!?!?!?!?

--
| Lelio Fulgenzi | Le...@SuppServ.CCS.UoGuelph.Ca
| Computing & Communications Services | Le...@Herman.CS.UoGuelph.Ca
| University of Guelph |
| Guelph, Ontario | DISCLAIMER:
| N1G 2W1 | All Ideas are MINE....
| Voice : (519) 824-4120 Ext.8044 | Give Credit
| Fax : (519) 767-1620 | Where Credit Is Due

Randal L. Schwartz

unread,
Oct 8, 1993, 2:34:58 PM10/8/93
to
>>>>> On 7 Oct 1993 21:47:12 GMT, le...@herman.cs.uoguelph.ca (Lelio Fulgenzi) said:

Lelio> This has got me stumped:

Lelio> I want to search for:


Lelio> PS1=\\
Lelio> [ "'$HOSTNAME ]
Lelio> [ $PWD'" ] "

Lelio> and replace with something alot simpler, for example,

Lelio> PS1='[ $PWD ]'

Lelio> any clues?!?!?!?!?

perl -i.bak -e 'undef $/; $_ = <>; s/PS1=\\\n\[.*\n\[.*/PS1='[ \$PWD ]'/; print' .profile


Use the right tools for the right jobs. Perl isn't *always* the
right solution, but it sure works for things like this.

Just another Perl hacker,
--
Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
mer...@ora.com (semi-permanent) mer...@agora.rain.com (for newsreading only)
phrase: "Welcome to Portland, Oregon ... home of the California Raisins!"

0 new messages